package com.xiaoye.service;

import cn.hutool.core.util.ObjectUtil;
import com.xiaoye.constant.ReportConstant;
import com.xiaoye.dao.MeetingMapper;
import com.xiaoye.dto.ResponseResult;
import com.xiaoye.entity.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author 宵夜
 * @version 1.0.0
 * @Description: TODO
 */
@Service
@Slf4j
public class MeetingService {
    @Resource
    private MeetingMapper meetingMapper;

    @Resource
    private TeacherService teacherService;

    @Resource
    private ReportService reportService;

    @Resource
    private MessageService messageService;

    @Resource
    @Lazy
    private AppointmentService appointmentService;


    public boolean insert(Meeting meeting) {
        return meetingMapper.insert(meeting) == 1;
    }


    public boolean deleteById(Integer id) {
        return meetingMapper.deleteById(id) == 1;
    }


    public Meeting getById(Integer id) {
        return meetingMapper.getById(id);
    }


    public Meeting getByReportId(Integer id) {
        return meetingMapper.getByReportId(id);
    }


    public List<Meeting> listMeetings() {
        return meetingMapper.listMeetings();
    }


    public List<Meeting> listAppointmentEndMeetings(Integer collegeId) {
        return meetingMapper.listAppointmentEndMeetings(collegeId);
    }


    public List<Meeting> listFinishMeetings(Integer collegeId) {
        return meetingMapper.listFinishMeetings(collegeId);
    }


    public List<Meeting> listMyFinishMeetings(Integer id) {
        return meetingMapper.listMyFinishMeetings(id);
    }


    public List<Meeting> searchMeetings(String year, String semester, Integer collegeId) {
        return meetingMapper.searchMeetings(year, semester, collegeId);
    }


    public List<Meeting> listMeetings(Meeting meeting) {
        return meetingMapper.listMeetings(meeting);
    }


    public int countMeetings(Meeting meeting) {
        return meetingMapper.countMeetings(meeting);
    }


    public boolean update(Meeting meeting) {
        return meetingMapper.update(meeting) == 1;
    }


    public List<Meeting> listAppointingMeeting(Integer studentId) {
        return meetingMapper.listAppointingMeeting(studentId);
    }


    public List<Meeting> listAppointingFinishMeeting(Integer studentId) {
        return meetingMapper.listAppointingFinishMeeting(studentId);
    }


    public List<String> getAllYears(Integer collegeId) {
        return meetingMapper.getAllYears(collegeId);
    }

    }



